
{% load i18n %}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	<head>
		<link rel="stylesheet" type="text/css" href="/media/css/flexigrid.pack.css" />
		<script src="/media/jslib/jquery.js"></script>
		<style>
		</style>
			{% block custom_css %}
			{% endblock %}  
	
		
		<script type="text/javascript">

		</script>

	</head>
<body style=" background:white;">
{% block content %}
			<!-- grid start -->
           <div  id="id_main_div" style="margin:0px;">
				<table class="m_grid" style="display: none"></table>
           </div>
		   <!-- grid end -->
		   <iframe id="export_ifm" width="0" height="0"></iframe>
{% endblock %}
</body>
<script type="text/javascript" src="{{ MEDIA_URL }}/jslib/jquery.validate.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}/jslib/i18n.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}/jslib/i18n_{{ LANGUAGE_CODE }}.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}/jslib/flexigrid.pack.js"></script>
<script type="text/javascript" src="{{ MEDIA_URL }}/jslib/m.gridutils.js" type="text/javascript"></script>
<script>
		function get_row_data(obj_id){
		    var data = []
		    $("#"+obj_id).children('td').each(function(){
		    	var text_ = $(this).children('div').html()
		        data.push(text_=="&nbsp;"?"":text_)
		    })
		    return data
		}
		function band_show_photo(){
			$(".m_grid tbody tr").each(function(){
				$(this).click(function(){
					var row_data = get_row_data($(this).attr("id"));
					var pin = row_data[1];
					var name = row_data[2];
					var dept_name = row_data[3];
					var atttime = row_data[4];
					var attarea = row_data[6];
					var sn = row_data[7];
					var url = "{{ MEDIA_URL }}/images/userImage_default.gif";
					var baseurl = "{{ MEDIA_URL }}/images/userImage_default.gif";
					if (sn != ""){
						var t_str=atttime.replace(/[-:]/g, "")
						url = "/{{request.surl}}data_store/att_pic"+"/"+sn+"/"+t_str.substr(0,4)+"/"+t_str.substr(4,2)+t_str.substr(6,2)+"/"+pin.replace(/\b(0+)/gi,"")+"_"+t_str.substr(9,6)+".jpg";
					}
					
					var html_str ='<table class="div_photoboxtab" width="100%" border="0" cellspacing="0" cellpadding="0">'+
										'<tr>'+
											'<td colspan="2" align="center" ><img  src='+url+' onerror="this.src=\''+baseurl+'\'"></td>'+
										'</tr>'+
										'<tr>'+
											'<th >'+gettext('人员编号')+':</th>'+
											'<td >'+pin+'</td>'+
										'</tr>'+
										'<tr>'+
											'<th >'+gettext('姓名')+':</th>'+
											'<td >'+(name.length>13?(name.substr(0,10)+"..."):name)+'</td>'+
										'</tr>'+
										'<tr>'+
											'<th >'+gettext('部门')+':</th>'+
											'<td >'+(dept_name.length>13?(dept_name.substr(0,10)+"..."):dept_name)+'</td>'+
										'</tr>'+
										'<tr>'+
											'<th >'+gettext('考勤时间')+':</th>'+
											'<td >'+atttime+'</td>'+
										'</tr>'+
										'<tr>'+
											'<th >'+gettext('考勤区域')+':</th>'+
											'<td >'+attarea+'</td>'+
										'</tr>'+
										'<tr>'+
											'<th >'+gettext('设备序列号')+':</th>'+
											'<td >'+sn+'</td>'+
										'</tr>'+
									'</table>';
					$('#photo_area', parent.document).html("").html(html_str);
				})
			})
		}

        {% autoescape off %}
		    var urlparams = {{urlparams}};
//			var bg_params = "/grid/{{app_label}}/{{model_name}}/?export&reportname={{model_name}}&";
			var bg_params = "/grid/{{app_label}}/{{model_name}}/?export&reportname={{verbose_name}}&";
			var hide_list = {{hide_list}};
			var $p = $(document);
			var m_util = new gridUtil($p,bg_params,hide_list);
			m_util.m_params = urlparams

			var m_option = {{grid_option}};
			m_option["params"] = urlparams;
			m_obj = $(".m_grid",$p).flexigrid(m_option);
        {% endautoescape %}
		function resize(){
			get_cur_util().get_grid().flexResize(document.body.clientWidth-2, 348);
		}
		if(window.XMLHttpRequest){window.onresize = resize;}
		window.onload = resize;
</script>
	{% block custom_js %}
	
	{% endblock %}  
</html>
